const express = require('express');
const { routeWrapper } = require('../../../lib/module/tool/route');
const router = express.Router();
const loginService = require('../../../lib/service/adminService');

// 管理员登录
router.post('/login', routeWrapper(async (req) => {
    return loginService.login(req.body.username, req.body.password);
}, false));

// 管理员信息
router.get('/info', routeWrapper(async (req) => {
    return loginService.getAdminInfo(req.auth.adminId, req.query.schoolName);
}, true));

// 查询用户列表
router.post('/userlist/:offset/:rows', routeWrapper(async (req) => {
    return loginService.getUserList(req.params.offset, req.params.rows, req.body);
}, true));

module.exports = router;
